import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server:{
    proxy:{
      '/admin': {
        // target: 'http://47.94.148.165',  // 写法1
        // target: 'http://121.89.205.189:3000',    // 写法2
        target: 'http://localhost:3001',    // 后端项目部署到本地
        changeOrigin: true,
        // rewrite: (path) => path.replace(/^\/admin/, '')
      },
    }
  }
})
